//引入三方VueRouter
import VueRouter from 'vue-router'
import { enhance } from '@/utils'
//引入自定义
import Home from '@/pages/Home'
import Search from '@/pages/Search'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
import NotFound from '@/pages/NotFound'
import Vue from 'vue'
//安装路由
Vue.use(VueRouter)

export default new VueRouter({
  // 路由器
  routes: [
    {
      // 首页
      path: '/',
      component: Home,
      meta: {
        isTypeNav: true,
        isFooterList: true,
      },
    },
    {
      // 搜索页
      path: '/search',
      component: Search,
      meta: {
        isTypeNav: true,
        isFooterList: true,
      },
    },
    {
      path: '/login',
      component: Login,
    },
    {
      path: '/register',
      component: Register,
    },
    {
      // 访问的地址/home会被重写向至/
      path: '/home',
      redirect: '/',
    },
    {
      // 当找不到匹配的路由
      path: '*',
      component: NotFound,
    },
  ],
  // 路由的模式
  mode: 'history',
})
enhance('push')
enhance('replace')
